#include <DrawingPolygon.hpp>

Drawing::Polygon::~Polygon()
{}

Drawing::Polygon::Polygon()
{}

Drawing::Polygon::Polygon(Vector3f* V1, Vector3f* V2, Vector3f* V3) : Modeling::Polygon(V1, V2, V3)
{}

Drawing::Material* Drawing::Polygon::getMaterial()
{
	return (Drawing::Material*)this->material;
}

void Drawing::Polygon::setMaterial(Drawing::Material* material)
{
	this->material = material;
}

void Drawing::Polygon::animate() 
{
	Modeling::Material* material = this->getMaterial();  

	glMaterialfv (GL_FRONT, GL_AMBIENT, (float*)material->getAmbient());
	glMaterialfv (GL_FRONT, GL_DIFFUSE, (float*)material->getDiffuse());
	glMaterialfv (GL_FRONT, GL_SPECULAR, (float*)material->getSpecular());
	
	glMaterialf (GL_FRONT, GL_SHININESS, material->getShininess());

	glBegin(GL_TRIANGLES);
	for (int i=0 ; i<3 ; i++) {
		glNormal3fv  ( (float*)this->getNormal(i) );
		glVertex3fv  ( (float*)this->getVertex(i) );
	}
	glEnd();
}
